package com.xf.day01

import java.io.PrintWriter
import scala.io.Source
import java.io.File

object FileIODemo {
  def main(args: Array[String]): Unit = {
    /**
     * 读取文件
     * 打印的结果为:
     * 1
     * 5
     * 2
     *
     * h
     * f
     */
    Source.fromFile("FileIO.txt").foreach(println)

    // 写文件
    val writer = new PrintWriter(new File("wFile.txt"))
    writer.write("8898989")
    writer.close()

  }

}
